<style type="text/css">
.form-inline .head {
	margin-bottom: 20px;
}
.form-inline .head input {
	margin-left: 20px;	
}
.form-inline .head .select-all {
	margin-bottom: 5px;
}
.form-inline .head label {
	margin-bottom: 0px;
}
</style>
<div class="pageheader">
	<h2>
		<i class="fa fa-inbox"></i>库存管理
	</h2>
	<div class="breadcrumb-wrapper">
		<span class="label">你所在的位置：</span>
		<ol class="breadcrumb">
			<li><a href="/index">ERP管理系统</a></li>
			<li>库存管理</li>
			<li class="active">实际缺货列表导出</li>
		</ol>
	</div>
</div>
<div class="contentpanel">
<div class="main">
    <form id="print-form" target="_blank" class="form-inline" action="/stock/printout" method="post">
        <div class="head">
            <a href="/outstock.csv" class="btn btn-primary">下载到本地</a>
            <input class="select-all btn btn-default" type="checkbox" name="checkall">
            <label>全选</label>
            <input class="print-all btn btn-default" type="submit" value="批量打印">
        </div>
        <div class="table-responsive">
            <table class="table table-bordered table-hover">
                <thead>
                    <tr>
                        <th>SKU</th>
                        <th>产品名称</th>
                        <th>网站与订单号</th>
                        <th>缺货信息</th>
                        <th>订单时间</th>
                    </tr>
                </thead>
                <tbody>
                    <?php 
                	$i=0;
                	$class = 'info';
                    foreach ($this->outstocklogs as $v){
                    	if($i>0){
                    		if($v['sku'] == $this->outstocklogs[$i-1]['sku']){
                    			//$class='info';
                    		}else{
                    			$class = $class=='warning'?'info':'warning';
                    		}
                    	}
                    	$i+=1;
                    ?>
		            <tr class="<?php echo $class;?>">
		                <td><input type="checkbox" name="isprint[]" value="<?php echo $v['sku'];?>">&nbsp;&nbsp;<?php echo $v['sku'];?></td>
			     	    <td><?php echo $v['title'];?></td>
			     	    <td><a target="_blank" href="<?php echo $this->url(array('controller'=>'log','action'=>'index','oid' =>$v['order_id'],'site'=>$v['site']),null,true)?>"><?php echo '网站：'.$v['site'].'；订单号：'.$v['order_id'];?></a></td>
						<td>
						<?php
						$info = json_decode($v['info']);
						foreach ( $info as $_v ) {
							if($_v[1]>0){
								echo $_v[0];
								echo '/' . $_v[1];
								echo '<input type="hidden" name="size['.$v['sku'].'][]" value="'.$_v[0].'">';
								echo '<input type="hidden" name="num['.$v['sku'].'][]" value="'.$_v[1].'">';
							}
		                    echo "&nbsp;&nbsp;";
		                }
		                ?>
		                </td>
		                <td><?php echo $v['add_time'];?></td>
		            </tr>
		            <?php } ?>
                </tbody>
            </table>
        </div>
    </form>
</div>
</div>
